#!usr/bin/node

const {EventEmitter} = require('events');

const e = new EventEmitter();

e.on("hello",()=>{
  console.log("hello world");
})

e.on("bey",()=>{
  console.log("goodbey");
  process.exit();
})

setInterval(()=>{
  e.emit("hello");
},1000);

setTimeout(()=>{
  e.emit("bey")
},5000);

console.log(e.eventNames());
console.log(e.listenerCount("hello"));
